# re
import re
r1 = re.match('\d{3}', '1234abcd888')
print(r1)
print(r1.group())

r2 = re.search('\d{3}', '12a34565dfe6789')
print(r2)
print(r2.group())

r3 = re.findall('\d{3}', '123abc345667def678')
print(r3)

r4 = re.finditer('\d{3}', '123abc345667def678')
print(r4)
for item in r4:
    print(item)
    print(item.group())

words = 'How  are you? I am fine! And you'
r5 = re.split('\s+|\?|!', words)
print(r5)

comment = 'wocao,how dongt fuck'
print(comment)
r6 = re.sub('wocao|fuck', '***', comment, flags=re.IGNORECASE)
print(r6)

re_obj = re.compile('\d{3}')
r7 = re_obj.search('24334dgds65766123')
print(r7)
print(r7.group())
